/*
 * ProjectCreator.h
 *
 *  Created on: 2013-2-1
 *      Author: Dspark
 */

#ifndef PROJECTCREATOR_H_
#define PROJECTCREATOR_H_
#include <qlayout.h>
#include <qlabel.h>
#include <qwidget.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qtextedit.h>
#include <qdatetimeedit.h>
#include <qpushbutton.h>
#include "component/ManagerSelector.h"
class ProjectCreator : public QWidget{
	Q_OBJECT
public:
	ProjectCreator(User& user, QWidget* parent = 0);
	ProjectCreator(User& user, quint32 pid);
	virtual ~ProjectCreator();
Q_SIGNALS:
	void sig_succeed();
	void sig_fail();
protected:
	Q_SLOT void slt_saveProject();
protected:
	void initUI();
	bool isInvalid();
	void doUpdate();
	void doInsert();
	void loadData(quint32 pid);

	QGridLayout layout;
	QLabel lab_name,lab_startDate,lab_expDate,lab_totalBuget,lab_unit;
	QLineEdit input_name,input_totalBuget;
	QDateEdit input_startDate,input_expDate;
	QCheckBox input_finish;
	QLabel lab_comment;
	QTextEdit input_comment;
	ManagerSelector managerSelector;
	QPushButton submit;
	User& user;
	quint32 pid;
};

#endif /* PROJECTCREATOR_H_ */
